Flow-based color transfer from source graphic to target graphic

ABSTRACT

Certain embodiments involve flow-based color transfers from a source graphic to target graphic. For instance, a palette flow is computed that maps colors of a target color palette to colors of the source color palette (e.g., by minimizing an earth-mover distance with respect to the source and target color palettes). In some embodiments, such color palettes are extracted from vector graphics using path and shape data. To modify the target graphic, the target color from the target graphic is mapped, via the palette flow, to a modified target color using color information of the source color palette. A modification to the target graphic is performed (e.g., responsive to a preview function or recoloring command) by recoloring an object in the target color with the modified target color.

CROSS-REFERENCES TO RELATED APPLICATIONS

This application is a continuation of U.S. application Ser. No.16/533,308 filed on Aug. 6, 2019, now allowed, which is incorporated byreference in its entirety.

TECHNICAL FIELD

This disclosure relates generally to creating or manipulating artificialimages or other graphic objects. Specifically, the present disclosureinvolves flow-based color transfers from a source graphic to targetgraphic.

BACKGROUND

Graphics editing software is often used to create or modify digitalvisual content. These graphics editors are useful for generatingcreative content, such as artwork. Color schemes or themes provide amedium of expression in an artwork for an artist. A designer working onone piece of artwork could be influenced by a color theme from otherartwork (e.g., photographs, moodboards, paintings, drawings, etc.), andmay wish to replicate color theme from inspirational pieces in theartwork being created.

However, recoloring artwork can require extensive manual effort,particularly if the artwork being developed includes many differentcomponents. Examples of different components include different pathsused to depict shapes in vector graphics, different layers inmulti-layered images or graphics, etc. Additionally or alternatively,recoloring a particular piece of artwork with the color theme from adifferent piece of artwork could generate an aesthetically unpleasantresult, such that the extensive manual effort involved in the recoloringprocess must be undone and further revised.

SUMMARY

Certain embodiments involve flow-based color transfers from a sourcegraphic to target graphic. In some embodiments, a palette flow iscomputed that maps colors of a target color palette to colors of thesource color palette. To modify the target graphic, the target colorfrom the target graphic is mapped, via the palette flow, to a modifiedtarget color using color information of the source color palette. Forinstance, the palette flow could be computed by finding a set of flows,between the colors of the source color palette and a target color of thetarget color palette, that minimizes an earth-mover distance between atarget color distribution of the target color palette and a source colordistribution of the source color palette. In a recoloring operationusing a modified target color, the modified target color is computedfrom a weighted combination of source colors from the source colorpalette. In one example, the set of weights in this weighted combinationis the set of flows between the colors of the source color palette andthe target color. In another example, the set of weights in thisweighted combination is a normalized version of the set of flows betweenthe colors of the source color palette and the target color. Amodification to the target graphic is performed by recoloring an objectin the target color with the modified target color.

In additional or alternative embodiments, color palettes used inflow-based color transfers are extracted from a vector graphic image(e.g., a vector graphic). For instance, a target vector graphic can havepath data identifying shapes and colors. Extracting a target colorpalette from the target vector graphic may involve, among other steps,determining a shape from the path data, identifying the target colorthat is associated with the shape via the path data, and computing arespective weight for the target color within the target color palettebased on the shape. For instance, a palette-extraction process coulditerate through each shape in a target vector graphic. If a given shapehas not been encountered in a previous iteration, the shape's color isadded to the target color palette and a weight of the color is added tothe target color palette based on how much of the target vector graphicis occupied by the shape under consideration. If the shape has beenencountered in a previous iteration, the weight of the color within thetarget color palette may be increased based on how much of the targetvector graphic is occupied by the shape under consideration. Theextracted target color palette, as well as one or more source colorpalettes, can be used to compute one or more palette flows.

In additional or alternative embodiments, a workflow for performingflow-based color transfers is provided. For instance, a recoloring toolof a graphics manipulation application retrieves a set of sourcegraphics and displays the set of source graphics along with a targetgraphic. Palette flows are computed for the target graphic and thesource graphics. If a particular source graphic is selected, therecoloring tool uses a particular palette flow for a correspondingsource color palette to generate a preview of a recolored targetgraphic, to perform a recoloring operation, or both. The recoloredtarget graphic of the preview or the recoloring operation is generatedby changing color information in the target graphic into colorinformation from the source color palette.

These illustrative embodiments are mentioned not to limit or define thedisclosure, but to provide examples to aid understanding thereof.Additional embodiments are discussed in the Detailed Description, andfurther description is provided there.

BRIEF DESCRIPTION OF THE DRAWINGS

The patent or application file contains at least one drawing executed incolor. Copies of this patent or patent application publication withcolor drawing(s) will be provided by the Office upon request and paymentof the necessary fee.

Features, embodiments, and advantages of the present disclosure arebetter understood when the following Detailed Description is read withreference to the accompanying drawings.

FIG. 1 depicts an example of a computing environment for performingflow-based color transfers from a source graphic to a target graphic,according to certain embodiments of the present disclosure.

FIG. 2 depicts an example of a process for executing a workflow thatuses one or more flows computed from source and target color palettes totransfer color information from a source graphic to a target graphicusing the computing environment of FIG. 1, according to certainembodiments of the present disclosure.

FIG. 3 depicts an example of a recoloring interface that is used forexecuting recoloring workflows such as the process of FIG. 2, accordingto certain embodiments of the present disclosure.

FIG. 4 depicts an example in which the recoloring interface from FIG. 3has been updated to display previews of a recolored target graphic,according to certain embodiments of the present disclosure.

FIG. 5 depicts an example of a process for performing a flow-based colortransfer from a source graphic to target graphic using the computingenvironment of FIG. 1, according to certain embodiments of the presentdisclosure.

FIG. 6 depicts an example of a process for extracting color palettesfrom vector graphics using the computing environment of FIG. 1,according to certain embodiments of the present disclosure.

FIG. 7 depicts an example of an interface element for modifying weightsof colors in a color palette used in the computing environment of FIG.1, according to certain embodiments of the present disclosure.

FIG. 8 depicts an example of a computing system that can implement thecomputing environment of FIG. 1, according to certain embodiments of thepresent disclosure.

FIG. 9 depicts an example of a recoloring process using differentuser-specified variations in the weights from a source color palette,according to certain embodiments of the present disclosure.

FIG. 10 depicts an example of a recoloring process using differentluminance control settings, according to certain embodiments of thepresent disclosure.

FIG. 11 depicts an example of a recoloring process using differentbackground control settings, according to certain embodiments of thepresent disclosure.

FIG. 12 depicts an example of an improved aesthetic quality that isachieved by performing a flow-based color transfer, according to certainembodiments of the present disclosure.

FIG. 13 depicts an example of an interface displaying a color palettethat is extracted from a vector graphic having a shape with agradient-based fill, according to certain embodiments of the presentdisclosure.

DETAILED DESCRIPTION

The present disclosure involves flow-based color transfers from a sourcegraphic to target graphic. For instance, color information istransferred from a source graphic to a target graphic using a paletteflow, which maps colors of the source graphic to corresponding colors ofthe target graphic. In one example, a graphics editor provides arecoloring workflow in which color palettes are extracted from a targetgraphic being edited and from one or more source graphics having colorcombinations that a user wishes to apply to the target graphic. In theworkflow, the graphics editor uses the extracted color palettes tocompute a transfer function that provides a mapping (i.e., a paletteflow) between colors of a source graphic and colors of the targetgraphic. In some cases, the computation of this palette flow iscontrolled by one or more user-specified configuration settings, such assettings for including or excluding luminance values when performing theflow computation, including or excluding certain background colors whenperforming the flow computation, modifying color densities within apalette, etc. The graphics editor uses the computed palette flow tomodify colors of the target graphic to match (or more closely resemble)colors of the source graphic.

The following non-limiting examples are provided to introduce certainembodiments. In these examples, a graphics editor is used to implement arecoloring workflow for a target graphic using a source graphic. Thetarget graphic and the source graphic need not have the same semanticcontent. For instance, the target graphic could depict a scene of aneighborhood on a snowy day, whereas the source graphic could depict awhale swimming in an aquarium. A user may wish to change the colorscheme of this target graphic, which might include predominantly orangeand red coloring, to more closely resemble the color scheme of thesource graphic, which might include predominantly blue and yellowcoloring. To implement this change, the graphics editor computes apalette flow that maps colors of a target color palette from the targetgraphic to colors of a source color palette from the source graphic.Each of these color palettes includes a set of colors that occur withinthe graphic, along with weights indicating respective densities of thecolors within the color palette (e.g., how much of the graphic includescontent having a particular color).

In one example, the palette flow indicates that certain weightedcombinations of colors in the source graphic are used to replace colorsin the target graphic. For instance, in the scenario above, the paletteflow indicates that different shades of blue in the aquarium scene areto be mapped, via a weighted combination of these blue colors, to anorange color in the neighborhood scene. The graphics editor modifies thetarget graphic by changing target color information from the targetcolor palette graphic into color information from the source colorpalette. For instance, the graphics editor recolors all orange objectsin the neighborhood scene to have a weighted combination of blue colorsfrom the aquarium scene.

In some embodiments for implementing such an example, the graphicseditor computes the palette flow by modelling differences between thetarget color palette and the source color palette as a flow-optimizationproblem. For instance, the graphics editor models the target colorpalette and the associated densities of its colors as a target colordistribution. Similarly, the graphics editor models the source colorpalette and the associated densities of its colors as a source colordistribution. The flow-optimization problem involves determining how tochange the source color distribution into the target color distribution.In the flow-optimization problem, changing the source color distributioninto the target color distribution involves modeling a movement of acertain amount of mass along a distance between a first point in a colorspace, such as a first set of L*a*b* color space values, and a secondpoint in the color space, such as a second set of L*a*b* color spacevalues. In this scenario, the modeled “mass” is referred to as a “flow”between a first color, which is defined by the first set of L*a*b* colorspace values, and a second color, which is defined by the second set ofL*a*b* color space values. In one example, solving the flow-optimizationinvolves minimizing, subject to certain constraints, an earth-moverdistance, where the earth-mover distance is an amount of work (i.e., asum of products of the flows and distances discussed above) involved inchanging the source color distribution into the target colordistribution. The graphics editor determines a set of flows between thesource color distribution and the target color distribution thatminimize the earth-mover distance without violating these constraints.The resulting set of flows are included in the palette flow and aretherefore used by the graphics editor to recolor the target graphic.

In some embodiments, which involve target graphics that are vectorgraphics, the graphics editor leverages attributes specific to vectorgraphics in order to extract a target color palette used in therecoloring workflow described above. For instance, a target vectorgraphic includes path data. This path data specifies a shape of a pathwithin the target vector graphic (e.g., parameters defining a rectangle,a circle, etc.) and color information for the path (e.g., stroke color,fill color, etc.). The graphics editor uses the color information of thepath data to identify a set of colors for the target color palette,examples of which are described below. The graphics editor also uses thespecified shapes of paths to compute densities (and associated weights)of these colors in the target color palette.

Utilizing parameter values from a vector graphic can provide processingefficiencies in the recoloring workflow. In one example, if a path has asolid fill color, the graphics editor can select the specified fillcolor for the target color palette. Simply selecting the value of the“fill” parameter allows the graphics editor to identify this palettecolor more quickly than, for example, techniques that require evaluatingeach pixel in a graphic to determine which colors should be included inthe target color palette. In another example, if a path has a shadingconstruct in which color values gradually change across the face of thepath (e.g., transitioning from a red to a blue color to provide a shadedpurple appearance), the graphics editor identifies discrete colors thatdefine the shading construct (i.e., the “red” and “blue” colors). Thegraphics editor uses these identified discrete colors to guide aclustering process that determines the palette colors. For instance, thegraphics editor performs a k-means clustering process on pixels' colorvalues and selects a set of colors corresponding to the centers of theresulting clusters as the target color palette. In the k-meansclustering process, the cluster centers are initially set to thediscrete colors from the shading construct of the target vector graphic.Providing this guidance allows the k-means clustering process toconverge more quickly.

In additional or alternative embodiments, the graphics editor includes auser-facing recoloring interface, which allows a user to configuredifferent attributes of the workflow described above, to preview theresults of applying the workflow to different source graphics, or both.For instance, the graphics editor could present, within a recoloringinterface, a target graphic and a set of source graphics retrieved fromdifferent data sources (e.g., online repositories, local directories,etc.). If the graphics editor receives a selection of a given sourcegraphic, the graphics editor responds to this selection by creating apreview of a recolored target graphic. The recolored target graphic isgenerated using a palette flow that is computed for the selected sourcegraphic, thereby allowing a user to assess the aesthetic quality (e.g.coherence, consistency, etc.) of the recolored target graphic.

In this example, the graphics editor computes different palette flowsfor the different source graphics. In some cases, a palette flowcomputation is modified based on certain user preferences. For instance,the recoloring interface could include an option for a user to modifythe densities (i.e., weights) in a source color palette, a target colorpalette, or both. The flow optimization process described above involvesminimizing an objective function subject to certain constraints thatcorrespond to weights in one or more of these color palettes. Thus,user-specified changes to these weights result in changes to theflow-based color transfer (e.g., increasing the density of a particularsource color within a recolored target graphic).

Furthermore, in some instances of a palette extraction process, thegraphics editor uses inputs received via the recoloring interface toexclude certain colors (e.g., background colors that heavilypredominate) or color information (e.g., luminance values that mightchange a “daytime” scene into a “nighttime” scene if included in asource color palette) from the palette extraction process. Efficienciesprovided by certain palette-extraction techniques described above canallow this recoloring process to be performed with minimal orunnoticeable delay (e.g., a few milliseconds).

Certain embodiments provide improvements to computing systems used forgenerating or editing creative content or other graphical content. Forinstance, existing techniques often entail cumbersome or time-consumingprocesses for transferring a color scheme from a source graphic toanother graphic. These cumbersome or time-consuming processes can bemitigated by one or more features described herein. For instance,interface features for configuring the operation of a recoloring processcan allow designers or other users to control various aspects of therecoloring process (e.g., transfer of luminance values, backgroundcolors, etc. if desirable). In another example, interface features forpreviewing the results of a recoloring process could enable a designerto visualize color transfers from a set of different source graphics ina single preview, thereby allowing for quick color exploration of vectorart. In some cases, various combinations of these features provide anintuitive, end-to-end tool for assessing and implementing modificationsto color combinations in a target graphics to more closely match thecolor used in different source graphics.

Referring now to the drawings, FIG. 1 depicts an example of a computingenvironment 100 in which a graphics editor 102 is used for performingflow-based color transfers from a source graphic 112 to a target graphic110. In this example, the source graphic 112, which is a digital fileincluding one or more images or other graphics, provides a source ofcolor information for a color transfer. The target graphic 110 is adigital file that includes one or more images or other graphics beingedited within the computing environment 100. For instance, a user thatis a designer may wish to use a color theme from a source graphic 112(e.g., artwork, a photograph, or a moodboard) and use this color themeas an inspiration for a design that is depicted in the target graphic110. The designer uses the graphics editor 102 to transfer this colortheme from the source graphic 112 to the target graphic 110, therebygenerating a recolored target graphic 114. The recolored target graphic114 retains the semantic content of the target graphic 110, such as thedepicted buildings, and has a color scheme that is derived from thesource graphic 112. For instance, the color scheme of the recoloredtarget graphic 114 can include a set of colors that are differentweighted combinations of colors from the source graphic 112.

In some embodiments, a target graphic 110, a source graphic 112, or bothare represented as vector graphics. A vector graphic can be organized asa set of paths having attributes such as stroke color, fill color, etc.For example, in some vector graphics, the geometry of various shapes ismodelled by bounded cubic Bezier splines. Such shapes are filled usingsolid colors (e.g., red, green, blue) or shading constructs thatidentify a set of discrete colors and a manner of deriving other colorsfrom the discrete colors, such as linear or radial gradients that causea display of color values that transition from a first discrete color ofthe shading construct to a second discrete color of the shadingconstruct.

The graphics editor 102 includes one or more software tools or engines.Each software tool or engine includes program code executable by one ormore processing devices to perform operations described here. Examplesof this program code include program code for rendering content fordisplay, program code for creating graphical interfaces (e.g., theinterfaces depicted in FIGS. 3, 4, and 7) having instances of eventlisteners or other suitable objects for receiving input from inputdevices (e.g., a mouse, a touchscreen, etc.), program code for modifyingcolor information for pixels or other objects included in a graphic,etc. In the example depicted in FIG. 1, the graphics editor 102 includesa recoloring tool 104, a color-update engine 106, and apalette-extraction engine 108.

The recoloring tool 104 provides one or more user interface featureshaving functions that control how recoloring operations are performed.For instance, the recoloring tool 104 can configure a display device topresent a recoloring interface that allows users to preview, assess, andmodify different variations in colors of the target graphic 110 usingone or more source graphics 112. In the example of FIG. 1, therecoloring tool 104 receives commands and other inputs from a user thatcan transfer a color theme (e.g., the use of red, dark blue, and purplecoloring) of the source graphic 112 to the semantic content (e.g., ascene depicting different buildings) of the target graphic 110. Therecoloring tool 104 communicates with the color-update engine 106 andthe palette-extraction engine 108 to effect this color transfer.

For instance, the color-update engine 106 performs one or moreoperations that generate a mapping between a source color palette of thesource graphic 112 and a target color palette of the target graphic 110.Such a mapping indicates, for example, that a first color from thesource graphic 112 is mapped to a second color from the target graphic110. The color-update engine 106 can use the mapping to modify colorinformation (e.g., pixel data, “fill” color, etc.) for an object fromthe target graphic 110. For instance, if an object in the target graphic110 has the second color, and the second color is mapped to the firstcolor from the source graphic 112, the color-update engine 106 generatesa recolored target graphic 114 by updating the object in the targetgraphic 110 to have the second color. In the simplified example depictedin FIG. 1, this recoloring process involves changing a lightly coloredorange building depicted in the target graphic 110 into a dark bluebuilding depicted in the recolored target graphic 114.

In some embodiments, the color-update engine 106 generates a mapping bydetermining parameters of a transfer function. The transfer functionindicates how to transform a distribution of colors found in the sourcegraphic 112 into a distribution of colors found in the target graphic110. A distribution of colors includes colors from a graphic's colorpalette (e.g., colors defining a color theme depicted in the graphic)and associated densities of the colors. In a simplified example, adensity for a particular color in a graphic could be a proportion of thegraphic, as rendered, that includes that particular color. Thecolor-update engine 106 computes parameters of the transfer function bymodeling, as a flow-optimization problem, the transformation of a sourcegraphic's color distribution into a target graphic's color distribution.Solving the flow-optimization problem involves determining flows fromsource colors to target colors, e.g., determining which weightedcombinations of source colors result in a given target color, or viceversa.

In some embodiments, the graphics editor 102 uses the palette-extractionengine 108 to extract a target color palette from the target graphic110, a source color palette from the source graphic 112, or both. Apalette-extraction process involves identifying unique colors of atarget graphic 110 or a source graphic 112. Examples of identifyingunique colors include identifying pixel values of a graphic as rendered,identifying fill colors of a vector graphic, identifying discrete colorsused to define a gradient in a vector graphic, or some combinationthereof. A palette-extraction process also involves identifyingrespective densities of colors in the palette.

Example of a Workflow for Performing Flow-Based Color Transfers

FIG. 2 depicts an example of a process 200 for a workflow that uses oneor more palette flows computed from source and target color palettes totransfer color information from a source graphic to a target graphic.One or more operations described with respect to FIG. 2, as well asassociated examples from one or more of FIGS. 1 and 3-7, can be used toimplement a step for executing a workflow in which a palette flowbetween a source color palette and a target color palette is used totransfer color information from a source graphic to a target graphic. Insome embodiments, one or more computing devices implement operationsdepicted in FIG. 2 by executing suitable program code (e.g., therecoloring tool 104 or another engine of the graphics editor 102). Forillustrative purposes, the process 200 is described with reference tocertain examples depicted in the figures. Other implementations,however, are possible.

At block 202, the process 200 involves retrieving a set of sourcegraphics. For instance, a recoloring tool 104 (or another tool of thegraphics editor 102) could configure a processing device to retrieve oneor more source graphics from a non-transitory computer-readable medium.In various embodiments, this non-transitory computer-readable medium islocal to a computing device that includes the processing device or isincluded in a remote computing system accessible over a data network.

In some embodiments, the recoloring tool 104 accesses one or more sourcegraphics from an online repository. For instance, an online repositorycould store artwork images, or other source graphics or target graphicsthat are accessible by a user of the computing environment 100. Theonline repository could store different artwork of various categoriesand can provide a search capability for retrieving certain graphicsbased on tags applied to the graphics. If a user, such as an artist,wishes to follow the coloring style of an expert designer forinspiration, the user can instruct the recoloring tool 104 to retrievegraphics generated by the designer from a portfolio.

FIG. 3 depicts an example of a recoloring interface 300 that is used forexecuting recoloring workflows. In this example, the recoloringinterface 300 includes a target display region 302 for displaying atarget graphic 304, a source display region 306 for displaying one ormore source graphics 308 a-c, and a tool selection region 309. The toolselection region 309 includes various control elements. For instance, inFIG. 3, the tool selection region 309 includes graphics-selectioninterface elements 310 a-c, a recoloring command interface element 312,a luminance-control interface element 314, a background-controlinterface element 316, and a preview control element 318.

The recoloring interface 300 is configured to receive one or more inputsthat are used for implementing block 202. If the recoloring tool 104receives a selection of one or more of the graphics-selection interfaceelements 310 a-c, the recoloring tool 104 responds to the selection bypresenting a window, a pane, or other interface element for browsingsource graphics. For instance, a selection of the graphics-selectioninterface elements 310 a and 310 b causes the recoloring tool 104 topresent a window or other interface element for browsing differentonline repositories. Similarly, a selection of the graphics-selectioninterface element 310 c causes the recoloring tool 104 to present awindow or other interface element for browsing a directory located on anon-transitory computer-readable medium that is accessible to thegraphics editor 102.

Returning to FIG. 2, at block 204, the process 200 involves displaying atarget graphic and the set of source graphics. For instance, in theexample of FIG. 3, a recoloring tool 104 (or another tool of thegraphics editor 102) updates a target display region 302 to depict atarget graphic 304. The recoloring tool 104 (or another tool of thegraphics editor 102) also updates a source display region 306 to depictvarious source graphics 308 a-c, which can be source graphics that areselected using one or more graphics-selection interface elements 310a-c.

At block 206, the process 200 involves computing palette flows that mapcolor information of a target color palette for the target graphic tocolor information of each source color palette for each source graphicin the set of source graphics. For instance, a recoloring tool 104 (oranother tool of the graphics editor 102) can request or instruct acolor-update engine 106 to compute flows for each source graphic thathas been selected via the recoloring interface 300. Examples ofcomputing these flows are described herein with respect to FIG. 5.

At block 208, the process 200 involves receiving a selection of aparticular source graphic having a particular source color palette. Forinstance, a recoloring tool 104 (or another tool of the graphics editor102) receives one or more selection inputs via the source display region306. A selection input can indicate that a user wishes to explore acolor variation that involves transferring color information from asource color palette to a target graphic 304.

Blocks 206 and 208 can be performed in any suitable order. In someembodiments, the graphics editor 102 can compute palette flows forsource graphics responsive to the source graphics being selected fordisplay within the recoloring tool 104 (i.e., block 206 can occur beforeblock 208). In additional or alternative embodiments, the graphicseditor 102 can compute palette flows for source graphics responsive to apreview or recoloring command being selected within the recoloring tool104 (i.e., block 206 can occur after block 208).

At block 210, the process 200 involves generating a recolored targetgraphic by using a particular palette flow for a particular sourcegraphic to change color information in the target graphic into colorinformation from the particular source color palette. For instance, arecoloring tool 104 (or another tool of the graphics editor 102) canrespond to the selection received at block 208 by modifying color valuesin a target graphic. This modification causes the target graphic toinclude color values from a source color palette associated with aselected source graphic (e.g., one or more of the source graphics 308a-c selected via the recoloring interface 300). In some embodiments,modifying color values in a target graphic involves updating color datain a target vector graphic, such as modifying a “fill” parameter in apath object so that the fill color for the path object is a color fromthe source color palette rather than the color from the initial targetgraphic. In additional or alternative embodiments, modifying colorvalues in a target graphic involves updating pixel values in, forexample, a target raster graphic so that the pixel values are taken fromthe source color palette.

In some embodiments, generating a recolored target graphic involvesmodifying a copy of the target graphic used in a preview function of thegraphics editor 102. For instance, the recoloring interface 300 in theexample of FIG. 3 includes a preview control element 318, such as acheckbox. If the recoloring tool 104 receives an input to the previewcontrol element 318 indicating that a preview of the recolored targetgraphic should be displayed, the recoloring tool 104 can update therecoloring interface 300 to depict the preview.

FIG. 4 depicts an example in which the recoloring interface 300 has beenupdated in this manner. In this example, the source display region 306has been replaced with a preview region 402. The preview region 402displays a recolored target graphic 404 a that is a copy of the targetgraphic 304 that has been modified to include color information from asource color palette of the source graphic 308 a. The preview region 402also displays a recolored target graphic 404 b that is a copy of thetarget graphic 304 that has been modified to include color informationfrom a source color palette of the source graphic 308 b. The previewregion 402 also displays a recolored target graphic 404 c that is a copyof the target graphic 304 that has been modified to include colorinformation from a source color palette of the source graphic 308 c. Inthis manner, a user can see an in-window preview of the target graphic304 that has been re-colored using each of the selected source graphicsby simply clicking a “Preview” button. This in-window preview can allowa user to assess the resulting recoloring of the target graphic 304using these source graphics. Thus, a preview function such as the onedepicted in FIG. 4 could enable a designer to visualize color transfersfrom a set of different source graphics in a single preview, therebyallowing for quick color exploration of vector art.

In additional or alternative embodiments, generating a recolored targetgraphic to the target graphic involves creating a modified targetgraphic that is outputted by the graphics editor 102. For instance, arecoloring tool 104 can receive a recoloring command, such as a userinput to a recoloring command interface element 312. The recoloring tool104 can respond to the recoloring command by applying color informationfrom the source color palette to the target graphic. Applying colorinformation from the source color palette to the target graphic includeschanging target color information in the target graphic to includesource color information from a source color palette. The recoloredtarget graphic and its corresponding original target graphic can havethe same semantic content. In particular, the recoloring process can beperformed without modifying the geometry of some or all of the objectsdepicted in each of the target graphics.

A workflow such as the process described with respect to FIG. 2 can beaugmented with more detailed controls. In some embodiments, therecoloring tool 104 includes a luminance control that allows users tocontrol whether luminance values are transferred from a source graphicto a target graphic. The luminance control can be useful if, forexample, a source graphic and a target graphic have significantdifferences with respect to brightness, contrast, or both. For example,the user may be working on a target graphic with a bright illustration(suggesting that the illustration is set in daytime), while the sourcegraphic might have a dark setting (suggesting a night setting). If theuser wants to preserve the original theme of the target graphic, theuser can choose not to transfer luminance values, while transferringonly the chroma values.

In such embodiments, the recoloring tool 104 can represent colors of asource graphic in an L*a*b* color space, where a given color isrepresented as a color vector having a luminance vector element (L*) andvector elements for the a* and b* channels. The luminance vector elementidentifies a luminance value. The recoloring tool 104 can be configuredto include or exclude such luminance values when computing flows. In theexample of FIGS. 3 and 4, the luminance-control interface element 314can be used to select these configurations. For instance, if therecoloring tool 104 receives a user input to the luminance-controlinterface element 314 (e.g., selecting or de-selecting a checkbox), therecoloring tool 104 can respond to the user input by modifying aluminance control setting of the graphics editor 102. If the luminancecontrol setting indicates that luminance values should be excluded froma palette-extraction process, the recoloring tool 104 can cause apalette-extraction engine 108 to apply a palette-extraction process tocolor vectors of a source graphic in a manner that excludes theluminance vector element. If the luminance control setting indicatesthat luminance values should be included in a palette-extractionprocess, the recoloring tool 104 can cause a palette-extraction engine108 to apply a palette-extraction process to color vectors of a sourcegraphic in a manner that includes the luminance vector element.

In additional or alternative embodiments, the recoloring tool 104 caninclude a background control that allows users to control whether colorvalues of background colors in a source graphic are transferred from thesource graphic to a target graphic. The background control can be usefulin cases where, for example, a background color is present in abundance(e.g., as a backdrop of a depicted scene, such as the purple color insource graphic 112 of FIG. 1) and therefore dominates colors in thesource graphic that occur less frequently, but are intended tocharacterize the source graphic (e.g., the red and blue colors of thesmiling face in source graphic 112 of FIG. 1). In other cases, thetarget graphic or the source graphic may not have a clear background andexcluding the background color of the source graphic may provide moresoothing results when recoloring the target graphic.

To implement such a background control, the recoloring tool 104 canpresent a background-control interface element in a recoloringinterface. For instance, in FIG. 3, the recoloring interface 300includes a background-control interface element 316, which is acheckbox. If the recoloring tool 104 receives a user input to thebackground-control interface element 316 (e.g., selecting orde-selecting the checkbox), the recoloring tool 104 can respond to theuser input by modifying a background control setting of the graphicseditor 102. If the background control setting indicates that backgroundvalues should be excluded from a palette-extraction process, therecoloring tool 104 can cause a palette-extraction engine 108 to apply apalette-extraction process that ignores, discards, or otherwise excludescolor data corresponding to background colors. If the background controlsetting indicates that background colors should be included in apalette-extraction process, the recoloring tool 104 can cause apalette-extraction engine 108 to apply a palette-extraction process to asource graphic in a manner that includes one or more background colors.

A color can be identified as a background color in any suitable manner.In some embodiments, the graphics editor 102 presents one or moreoptions for a user to identify a particular color as a background color,such as presenting an interface element with color samples and allowinga user to select which of the colors are background colors. Inadditional or alternative embodiments, the graphics editor 102automatically identifies background colors, or suggests that certaincolors are background colors, based on their density within a graphic.For instance, the graphics editor 102 could identify, as a backgroundcolor, a color having the highest density within a graphic or a set ofcolors with the highest densities within the graphic. In some cases, thegraphics editor 102 solicits user input to confirm that such anautomatically identified background color should be classified as abackground color.

In some embodiments, modifying a luminance control setting, a backgroundcontrol setting, or both can cause one or more operations of the process200 to be repeated. For instance, if the graphics editor 102 receivesinput modifying one of these control settings, the recoloring tool 104can return to block 206 of the process 200 and re-compute flows that mapone or more target color palettes to one or more source color palettes.Re-computing a flow could involve performing a palette-extractionprocess with the modified control setting, e.g., changing an initialsource color palette that is extracted using a first luminance orbackground control setting into a different source color palette that isextracted using a second luminance or background control setting.Additionally or alternatively, re-computing a flow could involvemodifying an initial source color palette having a background color byremoving the background color from the initial source color palette,without repeating the palette-extraction process.

Example of a Process for Implementing Flow-Based Color Transfers

Any suitable process can be used to implement a flow-based colortransfer that recolors a target graphic based on colors of a sourcegraphic. For instance, FIG. 5 depicts an example of a process 500 forperforming a flow-based color transfer from a source graphic to targetgraphic. One or more operations described with respect to FIG. 3, aswell as associated examples from one or more of FIGS. 1, 2, and 4-7, canbe used to implement a step for computing a palette flow that maps colorinformation of a target color palette for the target graphic to colorinformation of a source color palette for a source graphic. In someembodiments, one or more computing devices implement operations depictedin FIG. 5 by executing suitable program code (e.g., the color-updateengine 106 or another engine of the graphics editor 102). Forillustrative purposes, the process 500 is described with reference tocertain examples depicted in the figures. Other implementations,however, are possible.

At block 502, the process 500 involves accessing a target color palettefor a target graphic and a source color palette for a source graphic.For instance, the color-update engine 106 can configure a processingdevice to retrieve one or more source color palettes and one or moretarget color palettes from a non-transitory computer-readable medium,which could be local to a computing device that includes the processingdevice or included in a remote computing system accessible over a datanetwork. In some embodiments, the graphics editor 102 performs one ormore palette-extraction processes that are used to automatically computethe target color palette, the source color palette, or both. Examples ofthese palette extraction processes are described herein with respect toFIG. 6. The graphics editor 102 stores the automatically computed targetcolor palette, the automatically computed source color palette, or both.

At block 504, the process 500 involves computing a palette flow thatmaps colors of the target color palette to colors of the source colorpalette. For instance, the color-update engine 106 determines parametersof a transfer function that maps a distribution of colors in the sourcegraphic to a distribution of colors in the target graphics.

In some embodiments, a palette flow includes flows that are computedbased on an amount of work required to transform a target colordistribution of the target color palette into a source colordistribution of the source color palette. For instance, computing thepalette flow could involve minimizing an earth-mover distance between atarget color distribution of the target color palette and a source colordistribution of the source color palette. Computing an earth-moverdistance can involve computing the amount of work required to change thesource color distribution into the target color distribution. Forinstance, the work contributed to the earth-mover distance by a sourcecolor and a target color is modeled as a movement of a certain amount ofmass along a distance between a first point in a color space, such as afirst set of L*a*b* color space values defining a target color, and asecond point in the color space, such as a second set of L*a*b* colorspace values defining a source color. In this scenario, the modeled“mass” is referred to as a “flow” between the target color, which isdefined by the first set of L*a*b* color space values, and the sourcecolor, which is defined by the second set of L*a*b* color space values.

A palette flow can include a set of these flows that are computed usingthe earth-mover distance. Certain flows between a given target color andmultiple source colors are used to compute a weighted combination of thesource colors that can be used to replace the target color. Using theearth-mover distance can, in some cases, result in improved coherencebeing maintained after a color transfer, and can also add robustness incases where there is a large difference between the distribution ofcolors within the source graphic color distribution and the distributionof colors within the target graphic. Thus, certain embodiments usingthis type of flow computation can generate recolored target graphicsthat have a high aesthetic quality.

In one example, the graphics editor 102 minimizes an earth-moverdistance subject to one or more constraints. Examples of theseconstraints include requiring a sum of flows for a target color in thetarget color palette to be less than or equal to a weight of the targetcolor in the target color distribution, requiring a sum of flows for asource color in the source color palette to be less than or equal to aweight of the source color in the source color distribution, or somecombination thereof.

In additional or alternative embodiments, minimizing the earth-moverdistance involves minimizing an objective function. For example, eachcolor palette used in block 504 includes a set of colors that occurwithin the graphic, along with weights indicating respective densitiesof the colors within the color palette (e.g., how much of the graphicincludes content having a particular color). The graphics editor 102 cancompute a total target weight that is a sum of weights of the colors inthe target color palette. The graphics editor 102 can also compute atotal source weight that is a sum of weights of the colors in the sourcecolor palette. The graphics editor 102 can select a total flowconstraint that is a minimum of the total target weight and the totalsource weight.

Continuing with this example, graphics editor 102 can access, from anon-transitory computer-readable medium used by the graphics editor 102,an objective function. The objective function could include a weightedsummation of distances with respect to the colors of the target colorpalette and the colors of the source color palette, where the distancesare weighed by flows with respect to the colors of the target colorpalette and the colors of the source color palette. For instance, eachterm of the weighted summation could include a distance that is weightedwith a flow, where the distance is a distance between a pair of colorsfrom the target color palette and the source color palette and the flowis a flow between that pair of colors.

In this example, the graphics editor 102 can determine, subject to a setof constraints, the flows that minimize the objective function. The setof constraints can include the sum of flows for the target color in thetarget color palette being less than or equal to the weight of thetarget color in the target color distribution. The set of constraintscan also include the sum of flows for the source color in the sourcecolor palette being less than or equal to the weight of the source colorin the source color distribution. The set of constraints can alsoinclude the sum of the flows with respect to the colors of the targetcolor palette and the colors of the source color palette being equal tothe total flow constraint.

In one example of the embodiment discussed above, C_(T) and C_(I) areweighted color distributions of target art and source graphic,respectively. In this example, C_(T) has m colors withC_(T)=(C_(T1);w_(C) _(T1) ),(C_(T2);w_(C) _(T2) ) . . . (C_(Tm); w_(C)_(Tm) ), where C_(Ti) is the ith color and w_(C) _(Ti) is the weight ofthe ith color. Similarly, C_(I) has n colors with C_(I)=(C_(I1); w_(C)_(I1) ), (C_(I2); w_(C) _(I2) ) . . . (C_(In);w_(C) _(In) ), whereC_(Ij) is the jth color and w_(C) _(Ij) is the weight of the jth color.(In some embodiments, m=n, but this example is applicable for any valuesof m, n>0.) The ground distance between C_(T) and C_(I) is D=[d_(C)_(Ti) _(,C) _(Ij) ]. The color-update engine 106 computes a palette flowF=[f_(i,j)], where f_(i,j) is a flow between target color C_(Ti) andsource color C_(Ij).

Continuing with this example, the color-update engine 106 computes apalette flow that minimizes a cost. For instance, the color-updateengine 106 accesses an objective function:

$\sum\limits_{i = 1}^{m}{\sum\limits_{j = 1}^{n}{f_{C_{Ti},C_{Ij}}d_{C_{Ti},C_{Ij}}}}$

The color-update engine 106 computes flows (i.e., f_(C) _(Ti) _(,C)_(Ij) for i=1 . . . m and j=1 . . . n) that minimize this objectivefunction subject to a set of constraints. One of these constraints isrepresented by the following formula:

f _(C) _(Ti) _(,C) _(Ij) ≥0,1≤i≤m,1≤j≤n

This constraint requires each flow from a target color to a source colorto have a value greater than 0. Another one of these constraints isrepresented by the following formula:

${{\sum\limits_{j = 1}^{n}f_{C_{Ti},C_{Ij}}} \leq w_{C_{Ti}}},{1 \leq i \leq m}$

This constraint requires that a sum of flows for a given target color ito be less than a weight for that target color i. Another one of theseconstraints is represented by the following formula:

${{\sum\limits_{i = 1}^{m}f_{C_{Ti},C_{Ij}}} \leq w_{C_{Ij}}},{1 \leq j \leq n}$

This constraint requires that a sum of flows for a given source color jto be less than a weight for that source color j. Another one of theseconstraints is represented by the following formula:

${\sum\limits_{i = 1}^{m}{\sum\limits_{j = 1}^{n}f_{C_{Ti},C_{Ij}}}} = {\min\left\{ {{\sum\limits_{i = 1}^{m}w_{C_{Ti}}},{\sum\limits_{j = 1}^{n}w_{C_{Ij}}}} \right\}}$

This total flow constraint requires that the sum of all of the flowsmust be equal to a minimum of a total target weight and a total sourceweight, where a total target weight Σ_(i=1) ^(m)w_(C) _(Ti) is a sum ofthe weights of the target colors in the target color palette and a totalsource weight Σ_(j=1) ^(n)w_(C) _(Ij) is a sum of the weights of thesource colors in the source color palette.

In this example, a palette flow F is computed by solving this linearoptimization problem. The earth-mover distance is defined as the worknormalized by the total flow, as represented in the following formula:

${{EMD}\left( {P,Q} \right)} = \frac{\sum_{i = 1}^{m}{\sum_{j = 1}^{n}{f_{C_{Ti},C_{Ij}}d_{C_{Ti},C_{Ij}}}}}{\sum_{i = 1}^{m}{\sum_{j = 1}^{n}f_{C_{Ti},c_{Ij}}}}$

In some embodiments, solving the linear optimization problem involvescomputing one or more sets of flows between the colors of the sourcecolor palette and one or more target color of the target color palettethat minimize the earth-mover distance. For instance, for a given targetcolor i, block 504 involves finding a set of flows between each ofsource color j in the source color palette that causes the earth-moverdistance to be minimized. The set of flows allows for recoloring objectsof the target graphic using color information from the source colorpalette, as described further below.

An illustrative example of a palette flow is provided in Table 1 below.In this simplified example, a source color palette has three sourcepalette colors and a target color palette has three target palettecolors. In this example, the palette flow is a data structure in which arecord for a given color from a target palette identifies the set flowsbetween that target color and the various source color palettes. Forinstance, a record for a first target color (identified as “targetpalette color 1” in the example of Table 1) would include data (e.g.,columns or other fields) identifying a flow of f_(1,1) between the firsttarget color and the first source color, a flow of f_(1,2) between thefirst target color and the second source color, and a flow of f_(1,3)between the first target color and the third source color.

TABLE 1 Palette flow example Source Source Source Palette PalettePalette Color Color Color 1 2 3 Target Palette f_(1, 1) f_(1, 2)f_(1, 3) Color 1 Target Palette f_(1, 1) f_(2, 2) f_(2, 3) Color 2Target Palette f_(3, 1) f_(3, 2) f_(3, 3) Color 3

In some embodiments, after obtaining the palette flow using earth-moverdistance, the color-update engine 106 attempts to harmonize the colors.This can be performed using the luminance value or without the luminancevalue. An example of such harmonization can be found in Chang et al.,“Palette-based Photo Recoloring,” ACM Transactions on Graphics, 2015.

At block 506, the process 500 involves mapping, via the palette flow,target color information included in the target graphic source colorinformation to the source color palette. For instance, the color-updateengine 106 accesses color information for pixels of a target graphicthat is a raster graphic, color parameters of a target graphic that is avector graphic, or some combination thereof. The color-update engine 106determines that a given portion of the target graphic (e.g., one or morepixels, a path object, etc.) has a particular color. The color-updateengine 106 identifies, for the particular color, the corresponding colorwithin the target color palette. In examples involving paths withconstant colors, the particular color and the corresponding color withinthe target color palette could be the same. In examples involving apalette color determined from a clustering process, the color-updateengine 106 identifies which color within the target color palette wasdetermined from the cluster to which the particular color was assigned.

In examples involving the minimization of an earth-mover distance, block506 involves mapping, via the palette flow, the target color from thetarget graphic to a modified target color that is a weighted combinationof source colors from the source color palette. The weights in thisweighted combination are the set of flows between the colors of thesource color palette and the target color that cause the earth-moverdistance to be minimized at block 504. An example of a formularepresenting this operation is provided below.

$C_{Ti}^{\prime} = \frac{\Sigma_{j = 1}^{n}f_{C_{Ti},C_{Ij}} \times C_{Ij}}{\Sigma_{j = 1}^{n}f_{C_{Ti},C_{Ij}}}$

In this formula, a modified color C′_(Ti) is computed from a set offlows f_(C) _(Ti) _(,C) _(Ij) between target color C_(Ti) and a sourcecolor C_(Ij). The summation of multiplying these flows by the sourcecolor C_(Ij) is normalized with respect to the summation of these flows.For instance, in the example above, the term Σ_(j=1) ^(n)f_(C) _(Ti)_(,C) _(Ij) ×C_(Ij) is divided by the term Σ_(j=1) ^(n)f_(C) _(Ti) _(,C)_(Ij) .

At block 508, the process 500 involves performing a modification to thetarget graphic by changing the target color information to using thesource color information. For instance, the graphics editor 102 modifiesa digital file containing the target graphic to include updated colorinformation. Examples of this modification include modifying colorinformation for pixels of a target graphic that is a raster graphic,modifying the values of one or more color parameters of a target graphicthat is a vector graphic, or some combination thereof.

In some embodiments, performing a modification to the target graphicinvolves modifying a copy of the target graphic used in a previewfunction of the graphics editor 102. For instance, a recoloring tool 104or other tool of the graphics editor 102 can retrieve a set of sourcegraphics that includes the source graphic. The recoloring tool 104 candisplay the target graphic and the set of source graphics in a suitableinterface, such interfaces described with respect to the examples ofFIGS. 2-4. The recoloring tool 104 can receive user input that isdirected to the source graphic as displayed within the interface of therecoloring tool 104, where the user input indicates a selection of thesource graphic. The recoloring tool 104 responds to this selection inputby generating a preview of a recolored target graphic. The previewrecolored target graphic is generated by modifying a copy of the targetgraphic to include the change from target color information to sourcecolor information described above with respect to block 508.

In additional or alternative embodiments, performing a modification tothe target graphic involves creating a modified target graphic that isoutputted by the graphics editor 102. For instance, a recoloring tool104 can receive a recoloring command. The recoloring tool 104 canrespond to the recoloring command by applying color information from thesource color palette to the target graphic. Applying color informationfrom the source color palette to the target graphic can include changingtarget color information in the target graphic to include source colorinformation, as described above with respect to block 508. The graphicseditor 102 outputs the recolored target graphic in a suitable format(e.g., as a raster graphic or vector graphic). Examples of outputtingthe recolored target graphic include transmitting the recolored targetgraphic to one or more target devices, saving the recolored targetgraphic to a non-transitory computer-readable medium, or somecombination thereof.

Example of a Process for Extracting Color Palettes

FIG. 6 depicts an example of a process 600 for extracting color palettesfrom vector graphics. One or more operations described with respect toFIG. 6, as well as one or more associated examples from FIG. 7, can beused to implement a step for extracting a target color palette from atarget vector graphic, a step for extracting a source color palette froma source vector graphic, or both. In some embodiments, one or morecomputing devices implement operations depicted in FIG. 6 by executingsuitable program code (e.g., the palette-extraction engine 108 oranother engine of the graphics editor 102). For illustrative purposes,the process 600 is described with reference to certain examples depictedin the figures. Other implementations, however, are possible.

At block 602, the process 600 involves accessing (i) a target vectorgraphic having path data identifying shapes and colors and (ii) a sourcegraphic. For instance, the palette-extraction engine 108 (or anotherengine of the graphics editor 102) performs one or more operations foraccessing source or target graphics, such as the operations describedherein with respect to block 202 of the process 200.

The palette-extraction engine 108 also performs one or morepalette-extraction processes that extract a target color palette, asource color palette, or both. In some embodiments, a palette-extractionprocess for a target color palette includes operations from blocks604-608. At block 604, the process 600 involves determining a shape frompath data of the target vector graphic. For instance, thepalette-extraction engine 108 can access one or more path objects from atarget vector graphic. The palette-extraction engine 108 can obtainshape data from a path object. Examples of this shape data include ashape type (e.g., circle, rectangle, etc.), key points of the shape(e.g., a center of a circle, vertices of a rectangle), information aboutline or curve lengths (e.g., a circle radius), etc. Thepalette-extraction engine 108 can identify various shapes within avector graphic based on the accessed shape data.

At block 606, the process 600 involves identifying a target color for atarget color palette that is associated with the shape via the pathdata. For instance, the palette-extraction engine 108 can access one ormore path objects from a target vector graphic. The palette-extractionengine 108 can reference various color parameters (e.g., stroke color,fill color, etc.) to identify or derive color information for the shapeas rendered. In one example, the palette-extraction engine 108 canidentify the color of a shape having a solid color by referencing a fillcolor. In another example, the palette-extraction engine 108 can deriveone or more colors of a shape having a shading construct by referencingvarious parameters of the shading construct (e.g., stop colors) andcomputing the resulting color information that would be displayed in therendered vector graphic.

At block 608, the process 600 involves computing a weight for the targetcolor of block 606 based on the shape. For instance, the graphics editor102 can determine, from the path data and the shape data, how much of avector graphic, as rendered, would be occupied by one or more shapeswith a given color. An increase in how much of a vector graphic, asrendered, is occupied by one or more shapes with a particular color cancorrespond to an increased weight for that particular color. A decreasein how much of a vector graphic, as rendered, is occupied by one or moreshapes with a particular color can correspond to a decreased weight forthat particular color.

In one example, blocks 604-608 are applied to vector graphics havingpaths with constant colors. In this example, the palette-extractionengine 108 implements block 604 by planarizing a target vector graphic.For instance, the target vector graphic could include a first path(i.e., a first shape) in a first layer and a second path (i.e., a secondshape) in a second layer having a portion that is positioned below thefirst path, such that a portion of the second path is obscured.Planarizing such a target vector graphic can involve creating a modifiedversion of the target vector graphic, where the modified version of thetarget vector graphic includes, in a single layer, the first path and amodified version of the second path in which the obscured portion of thesecond path is removed. Planarizing the target vector graphic canremove, from consideration by the palette-extraction process, color datafor obscured regions of a multilayer graphic, thereby resulting in amore accurate identification of colors and associated weights for acolor palette. For instance, if portion of a particular path is notvisible to a viewer when a target vector graphic is rendered, then acolor that only occurs in that obscured portion should be excluded fromthe resulting target color palette and/or the obscured portion of thepath should not be considered when determining the density (andassociated weight) of that color.

Continuing with this example of vector graphics having paths withconstant colors, the palette-extraction engine 108 implements block 604by identifying one or more planar faces from the target vector graphicthat has been planarized. The palette-extraction engine 108 canimplement block 606 by traversing each planar face and identifying eachunique color that is encountered via the traversal. As a simplifiedexample, a target vector graphic could be comprised of threenon-overlapping paths, i.e., three planar faces. Two of the planar facescould have a “red” color and one of the planar faces could have a “blue”color. At block 606, the palette-extraction engine 108 traverses thethree paths, identifies the two unique colors among the paths, and addsthese two unique colors (red and blue) to a target color palette.

Continuing with this example of vector graphics having paths withconstant colors, the palette-extraction engine 108 can implement block608 by computing a value indicating how much of the planarized targetvector graphic is occupied by a given color. To do so, thepalette-extraction engine 108 computes a total number of pixels occupiedby each path. For instance, palette-extraction engine 108 could create atemporary, rasterized copy of the target vector graphic from block 606(e.g., in a buffer of a graphics processing unit). Thepalette-extraction engine 108 also determines the total pixel coverageof the rasterized target vector graphic (i.e., the total number ofpixels used to render the rasterized target vector graphic). Thepalette-extraction engine 108 also determines, for each unique coloridentified at block 606, a respective number of pixels of the rasterizedtarget vector graphic having the unique color. The palette-extractionengine 108 computes a respective weight for the unique color bynormalizing the respective number of pixels having the unique color withrespect to the total pixel coverage of the rasterized target vectorgraphic. For instance, the normalization could involve dividing thenumber of pixels for the unique color by the total number of pixels usedto render the rasterized target vector graphic.

In some cases, generating a rasterized graphic in a buffer of a graphicsprocessing unit allows the palette extraction process to be performedmore efficiently. As a result, the recoloring process can be completedwith reduced processing time (e.g., within milliseconds), therebyproviding a more responsive and intuitive workflow (e.g., in the process500).

In another example, blocks 604-608 are applied to vector graphics havingpaths with shading constructs (e.g., linear or radial gradients,gradient meshes, freeform gradients, etc.). In this example, thepalette-extraction engine 108 can implement block 604 by identifying oneor more paths from the target vector graphic that include a shadingconstruct, and can implement block 606 using discrete colors specifiedin the shading construct. In one example, these discrete colors are thestop colors in a linear or radial gradient. To implement block 606, thepalette-extraction engine 108 can rasterize each path in the targetvector graphic having a shading construct. The palette-extraction engine108 performs a k-means clustering process on each rasterized path of thetarget vector graphic.

For instance, the k-means clustering process is used to cluster pointsdefined by vectors within a color space, where a given vector includesthe color values (e.g., a luminance value, red/green value, and ablue/yellow value) defining a given color in the color space (e.g., theL*a*b* color space). The palette-extraction engine 108 computes, foreach pixel in a given path, a set of L2 distances. Each L2 distance iscomputed between the pixel's color (i.e., the vector of color values fora pixel in a rasterized path) and a respective one of the clustercenters (i.e., the vector of color values for one of the discrete colorsof the shading construct). The palette-extraction engine 108 classifiesa given pixel as belonging to a certain cluster if the L2 distance forthe pixel's color and the cluster center is less than the L2 distancefor the pixel's color and any other cluster center.

In the k-means clustering process, the palette-extraction engine 108initializes the cluster centers using the discrete colors of the shadingconstruct. In the example above, different shading constructs can resultin different initializations in the k-means clustering process. If theshading construct is a linear or radial gradient, the palette-extractionengine 108 initializes bins by using stop colors of the gradient as theinitial cluster centers. If the shading construct is a gradient mesh,the palette-extraction engine 108 initializes bins by using, as theinitial cluster centers, the discrete colors that are applied tovertices of the paths. If the shading construct is a freeform gradient,the palette-extraction engine 108 initializes bins by enumerating colorsfrom color curves and points, where an effective color at each pixel ina freeform gradient is a weighted combination of these enumeratedcolors. Therefore, the palette-extraction engine 108 uses these weights,along with enumerated colors, to determine weighted color distributionsfor each path having a freeform gradient.

Continuing with this example involving shading constructs, thepalette-extraction engine 108 can implement block 608 using the clustersresulting from the k-means clustering process. For instance, a colorvalue at a cluster center can be used as one of the palette colors in atarget color palette. The palette-extraction engine 108 can compute aweight for this palette color by identifying the number of pixels thathave been classified as being in the cluster and normalizing the numberof pixels using the total pixel coverage of the path.

The palette-extraction engine 108 can also perform a palette-extractionprocess for a source color palette. An example of a palette-extractionprocess for a source color palette can include operations from blocks610-616. At block 610, the process 600 involves quantizing, into bins,color values of pixels from the source graphic. For instance, thepalette-extraction engine 108 can access a source graphic that is araster graphic or generate a rasterized version of a source graphic thatis a vector graphic. The palette-extraction engine 108 can identifycolor information for each pixel in the raster graphic. Thepalette-extraction engine 108 can quantize the pixels into bins based onthe color information. This quantization, in some cases, allows forimproved processing speeds (e.g., within milliseconds), therebyproviding a more responsive and intuitive workflow (e.g., in the process500).

At block 612, the process 600 involves grouping the quantized colorvalues into color clusters. For instance, the palette-extraction engine108 can perform k-means clustering on the binned color values from block610. In some embodiments, the palette-extraction engine 108 selects avalue of k (i.e., the number of centroids in the k-means clustering) atblock 610 that is equal to the number of discrete colors identified fora target graphic. In a simplified example, if the target graphic onlyincludes a path having a gradient mesh defined by three discrete colorsthat are applied to vertices, the palette-extraction engine 108 setsk=3. In another example, if a target color palette having six discretecolors is identified in blocks 604-608, the palette-extraction engine108 sets k=6.

At block 614, the process 600 involves computing the colors of thesource color palette from the color clusters, where each color from thesource color palette corresponds to a respective color cluster. Forinstance, the palette-extraction engine 108 selects a color at a clustercenter (e.g., the L*a*b* values from the vector identifying the locationof the cluster center) as one of the palette colors in the source colorpalette.

At block 616, the process 600 involves computing weights for the sourcecolor palette based on the respective numbers of pixels in the colorclusters. For instance, the palette-extraction engine 108 identifies,for a given palette color, the cluster from which the palette color wasdetermined. The palette-extraction engine 108 identifies the number ofpixels assigned to the cluster. The palette-extraction engine 108determines the total pixel coverage of the source graphic (i.e., thetotal number of pixels used to render the raster graphic accessed asblock 610). The palette-extraction engine 108 computes a weight for thegiven palette color by, for example, normalizing the respective numberof pixels associated with the palette color with respect to the totalpixel coverage of the source graphic. For instance, the normalizationcould involve dividing the number of pixels associated with the palettecolor by the total number of pixels used to render the source graphic,where the number of pixels associated with the palette color is thenumber of pixels assigned to the cluster from which the palette colorwas determined.

At block 618, the process 600 involves outputting a target colorpalette, a source color palette, or both. In embodiments involving theprocess 600, one or more of the outputted color palettes are used in aflow-computation process (e.g., the process 500) to compute a paletteflow that maps colors of the target color palette to colors of thesource color palette and to use the palette flow to modify colorinformation of the target vector graphic.

While FIG. 6 depicts a process for extracting color palettes from vectorgraphics, other implementations are possible. In some embodiments, thepalette-extraction engine 108 can extract a palette from a raster image.To do so, pixels of the raster graphic are quantized into bins. Thepalette-extraction engine 108 applies k-means clustering to the bins andthereby identifies palette colors from the target graphic. Inparticular, the palette-extraction engine 108 uses, as the targetpalette colors, the centers of clusters obtained from the convergence ofthe k-means clustering. The number of pixels assigned to a given clusteris used to compute a weight for a target palette color (i.e., the colordefined by the point at the cluster center). For instance, a number ofpixels assigned to a cluster is normalized by dividing the number ofpixels by the total number of pixels in the raster target graphic.

In some embodiments, a palette-extraction process for a vector graphic,a raster graphic, or both can involve converting color informationrepresented using a first color space into color information representedusing a second color space. For instance, the colors of the targetgraphic accessed at block 602, the source graphic accessed at block 602,or both could be originally represented in an RGB color space. In apalette-extraction process (e.g., blocks 604-608, blocks 610-616, or theraster-graphic palette extraction), the palette-extraction engine 108converts these colors from the RGB color space to an L*a*b* color space.In some embodiments, using an L*a*b* color space can improve theperformance of a recoloring process. In one example, using an L*a*b*color space allows for distinguishing between colors in a manner similarto how a human eye distinguishes between colors. In another example, aEuclidean distance between colors in an L*a*b* color space can provide amore useful measure of similarity between colors as compared to aEuclidean distance between colors in an RGB color space. In anotherexample, by using an L*a*b* color space, the graphics editor 102 hasaccess to the L* channel, i.e., a luminance parameter controlling thedarkness of an image. The graphics editor 102 can be configured, in somecases, to ignore the L* channel when performing a palette-extractionprocess (e.g., by applying a clustering process that only uses onlytwo-dimensions representing the a* and b* channels from the L*a*b* colorspace). Ignoring the L* channel can allow color information of a sourcegraphic to be transferred to a target graphic without modifying thebrightness or darkness of the target graphic in an undesirable manner.For instance, if a source graphic depicts a sunny day and a targetgraphic depicts a night scene, ignoring the L* channel can allow thetarget graphic to be recolored using the source color palette of thesource graphic without changing the “sunny” appearance of the targetgraphic.

In some embodiments, one or more weights used in the computation of apalette flow are modified via one or more user inputs. For instance, thegraphics editor 102 can present, in a recoloring tool 104, aweight-modification interface element. FIG. 7 depicts an example of aweight-modification interface element 702 prior to a user modificationand a corresponding weight-modification interface element 704 after auser modification. In this example, the weight-modification interfaceelement 702 displays visual indicators (i.e., colored rectangles) offive different colors (i.e., pink, green, orange, white, and blue) in acolor palette. The heights of the visual indicators indicate weights ofthe different colors. In this simplified example, theweight-modification interface element 702 indicates a weight of 0.2 foreach color. The weight-modification interface element 702 can receiveuser input (e.g., via a slider) that indicates a user-specified weightfor one or more colors in the source color palette. The graphics editor102 can respond to receiving this user input by modifying one or moreweights of one or more colors in the source color palette. The graphicseditor 102 can also indicate the modified weight by updating theappearance of the weight-modification interface element 702 to obtainweight-modification interface element 704. In this example, theweight-modification interface element 704 displays modified visualindicators (i.e., colored rectangles) of five different colors (i.e.,pink, green, orange, white, and blue) in a color palette. The modifiedheights of the visual indicators indicate weights of the differentcolors. In this simplified example, the weight-modification interfaceelement 704 indicates a weight of 0.3 for the pink color, which wasmodified from the weight of 0.2 indicated by the weight-modificationinterface element 704, and a weight of 0.175 for each other color in thecolor palette. The graphics editor 102 uses these modified weights tocompute a palette flow in the manner described above.

The example from FIG. 7 shows a variably sizable source color palettederived from a source graphic. The weight-modification interfaceelement, which can receive a sliding or dragging input, can provide anintuitive mechanism to change the relative distribution of colors in thesource color palette, such as by using a slider for increasing ordecreasing the relative density of any particular color. For instance,as shown in FIG. 7, if the palette contains a pink color and the userwants to have the target graphic recolored with a higher proportion ofpink, then the user can increase the proportion using the providedslider control.

In some embodiments, the graphics editor 102 updates a preview of arecolored target graphic to display how changes in the weights of thesource color palette will impact the recolored target graphic. Forinstance, a preview of a recolored target graphic could initially depicta recolored target graphic that is generated using an initial paletteflow, i.e., a palette flow computed using weights in the source colorpalette that are identified in a palette-extraction process. If thegraphics editor 102 receives a user input to a weight-modificationinterface element, the graphics editor 102 changes the preview from therecolored target graphic as initially depicted to the recolored targetgraphic generated with the one or more user-modified weights for thesource color palette.

Example of a Computing System for Implementing Certain Embodiments

Any suitable computing system or group of computing systems can be usedfor performing the operations described herein. For example, FIG. 8depicts an example of a computing system 800. In some aspects, thecomputing system 800 includes a processing device 802 that executesprogram code 805 (e.g., the graphics editor 102), a memory device 804that stores various program data 807 computed or used by operations inthe program code 805 (e.g., source graphics, target graphics, colorpalettes, etc.), one or more input devices 812, and a presentationdevice 814 that displays graphical content generated by executing theprogram code 805. For illustrative purposes, FIG. 8 depicts a singlecomputing system on which the program code 805 is executed, the programdata 807 is stored, and the input devices 812 and presentation device814 are present. But various applications, datasets, and devicesdescribed can be stored or included across different computing systemshaving devices similar to the devices depicted in FIG. 8.

The depicted example of a computing system 800 includes a processingdevice 802 communicatively coupled to one or more memory devices 804.The processing device 802 executes computer-executable program codestored in a memory device 804, accesses information stored in the memorydevice 804, or both. Examples of the processing device 802 include amicroprocessor, an application-specific integrated circuit (“ASIC”), afield-programmable gate array (“FPGA”), or any other suitable processingdevice. The processing device 802 can include any number of processingdevices, including a single processing device.

The memory device 804 includes any suitable non-transitorycomputer-readable medium for storing data, program code, or both. Acomputer-readable medium can include any electronic, optical, magnetic,or other storage device capable of providing a processor withcomputer-readable instructions or other program code 805. Non-limitingexamples of a computer-readable medium include a magnetic disk, a memorychip, a ROM, a RAM, an ASIC, optical storage, magnetic tape or othermagnetic storage, or any other medium from which a processing device canread instructions. The program code 805 may include processor-specificinstructions generated by a compiler or an interpreter from code writtenin any suitable computer-programming language, including, for example,C, C++, C#, Visual Basic, Java, Python, Perl, JavaScript, andActionScript.

The computing system 800 may also include a number of external orinternal devices, such as an input device 812, a presentation device814, or other input or output devices. For example, the computing system800 is shown with one or more input/output (“I/O”) interfaces 808. AnI/O interface 808 can receive input from input devices or provide outputto output devices. One or more buses 806 are also included in thecomputing system 800. The bus 806 communicatively couples one or morecomponents of a respective one of the computing system 800.

The computing system 800 executes program code that configures theprocessing device 802 to perform one or more of the operations describedherein. The program code includes, for example, the recoloring tool 104,the color-update engine 106, the palette-extraction engine 108, or othersuitable applications that perform one or more operations describedherein. The program code may be resident in the memory device 804 or anysuitable computer-readable medium and may be executed by the processingdevice 802 or any other suitable processor. The program code 805 uses orgenerates program data 807. Examples of the program data 807 include oneor more of the graphics, palettes, mappings, configuration settings,etc. described herein with respect to FIGS. 1-7.

In some aspects, the computing system 800 also includes a networkinterface device 810. The network interface device 810 includes anydevice or group of devices suitable for establishing a wired or wirelessdata connection to one or more data networks. Non-limiting examples ofthe network interface device 810 include an Ethernet network adapter, amodem, and/or the like. The computing system 800 is able to communicatewith one or more other computing devices via a data network using thenetwork interface device 810.

An input device 812 can include any device or group of devices suitablefor receiving visual, auditory, or other suitable input that controls oraffects the operations of the processing device 802. Non-limitingexamples of the input device 812 include a recording device, atouchscreen, a mouse, a keyboard, a microphone, a video camera, aseparate mobile computing device, etc. A presentation device 814 caninclude any device or group of devices suitable for providing visual,auditory, or other suitable sensory output. Non-limiting examples of thepresentation device 814 include a touchscreen, a monitor, a separatemobile computing device, etc.

Although FIG. 8 depicts the input device 812 and the presentation device814 as being local to the computing device that executes the programcode 805, other implementations are possible. For instance, in someaspects, one or more of the input device 812 and the presentation device814 can include a remote client-computing device that communicates withthe computing system 800 via the network interface device 810 using oneor more data networks described herein.

EXPERIMENTAL EXAMPLES

FIGS. 9-12 depict various experimental examples of graphics that areused by or generated with certain embodiments described herein.

FIG. 9 depicts an example of a recoloring process using differentuser-specified variations in the weights from a source color palette. Inthis example, a target graphic 902 is recolored, using a source graphic904 having an extracted source color palette represented by palette view906, to generate a recolored target graphic 908. Palette view 906visually depicts colors in the extracted source color palette, with theheights of colored sections indicating respective weights of thesepalette colors. Variations of the recoloring are also depicted in FIG.9. For instance, user inputs can cause the extracted source colorpalette represented by palette view 906 to be changed into modifiedsource color palettes represented by modified palette views 910 (havingan increased weight for the first palette color), 912 (having anincreased weight for the third palette color), and 914 (having anincreased weight for the fourth palette color). Performing a recoloringprocess with the modified source color palettes represented by modifiedpalette views 910, 912, and 914 generates the target graphic 916, 918,and 920, respectively.

FIG. 10 depicts an example of a recoloring process using differentluminance control settings. In this example, a target graphic 1002 isrecolored, using a source graphic 1004, to generate various recoloredtarget graphics 1006 and 1008. The recolored target graphic 1006 isgenerated with a recoloring process that includes a transfer ofluminance values. The recolored target graphic 1008 is generated with arecoloring process that excludes luminance values from a color transfer.Thus, the recolored target graphic 1008 has a similar brightness and/orcontrast as compared to the target graphic 1002, while being recoloredwith colors that more closely resemble the blue and gray coloring in thesource graphic 1004.

FIG. 11 depicts an example of a recoloring process using differentbackground control settings. In this example, a target graphic 1102 isrecolored, using a source graphic 1104, to generate various recoloredtarget graphics 1106 and 1108. The recolored target graphic 1106 isgenerated with a recoloring process that includes a transfer of abackground color. The recolored target graphic 1108 is generated with arecoloring process that excludes the background color from a colortransfer and/or uses a lower weight for the background color in thecolor transfer. Thus, the recolored target graphic 1108 has a smalleramount of green coloring (i.e., the background color in the sourcegraphic 1104) as compared to the recolored target graphic 1106.

FIG. 12 depicts experimental results of using a color transfer based onan earth-mover distance metric. In this example, a target graphic 1202is recolored, using a source graphic 1204, to generate various recoloredtarget graphics 1206 and 1208. The recolored target graphic 1206 isgenerated with a recoloring process that does not utilize an earth-moverdistance metric. The recolored target graphic 1208 is generated with arecoloring process that utilizes an earth-mover distance metric inaccordance with certain embodiments described herein with respect toFIG. 5. When the recolored target graphics 1206 and 1208 are compared,highlights used in the target graphic 1202 lose consistency in therecolored target graphic 1206, whereas the local coherence of thesehighlights are preserved in the recolored target graphic 1208 that usesan earth-mover distance metric.

For instance, the target graphic 1202 includes a door object in which ateal color with different luminance values predominates. In therecolored target graphic 1208 that uses an earth-mover distance metric,the door object is changed to a different predominant color thatlikewise includes different luminance values. But in the recoloredtarget graphic 1206 that does not use an earth-mover distance metric,the door object is changed to a set of multiple colors with differentchroma values, rather than merely having a difference in luminancevalues. Similar behavior can be found when comparing the suitcase objectin the various target graphics (particularly with respect to the body ofthe suitcase), comparing the surfboard object (particularly with respectto the fins) in the various target graphics, etc.

FIG. 13 depicts an example of an interface showing a color palette 1305extracted from a vector graphic 1302 having a shape with agradient-based fill. For instance, a horizontal region 1303 of the skydepicted in this example is colored using a gradient between a dark bluestop color (e.g., the palette color 1306) and a light blue stop color(e.g., the palette color 1308). In this example, the particular type ofgradient is selected via control 1304. The gradient is defined usingfour stop colors. The color palette, in this example, is extracted fromthe landscape (i.e., the ground, rives, trees, mountains, and sky)depicted by the vector graphic 1302. The extracted color paletteincludes palette colors 1306, 1308, 1310, and 1312 that are positionedat or near the stop colors within a color space. In this example,weights of the palette colors are visually depicted using thediamond-shaped boundary markers 1307, 1309, and 1313. For instance, thearea along the bar between the left edge and boundary marker 1307indicates the distribution of palette color 1306 within the vectorgraphic 1302. The area along the bar between the boundary markers 1307and 1309 indicates the distribution of palette color 1308 within thevector graphic 1302. The area along the bar between the boundary markers1309 and 1313 indicates the distribution of palette color 1310 withinthe vector graphic 1302. For instance, the area along the bar betweenthe right edge and boundary marker 1313 indicates the distribution ofpalette color 1308 within the vector graphic 1302.

General Considerations

Numerous specific details are set forth herein to provide a thoroughunderstanding of the claimed subject matter. However, those skilled inthe art will understand that the claimed subject matter may be practicedwithout these specific details. In other instances, methods,apparatuses, or systems that would be known by one of ordinary skillhave not been described in detail so as not to obscure claimed subjectmatter.

Unless specifically stated otherwise, it is appreciated that throughoutthis specification discussions utilizing terms such as “processing,”“computing,” “calculating,” “determining,” and “identifying” or the likerefer to actions or processes of a computing device, such as one or morecomputers or a similar electronic computing device or devices, thatmanipulate or transform data represented as physical electronic ormagnetic quantities within memories, registers, or other informationstorage devices, transmission devices, or display devices of thecomputing platform.

The system or systems discussed herein are not limited to any particularhardware architecture or configuration. A computing device can includeany suitable arrangement of components that provide a result conditionedon one or more inputs. Suitable computing devices include multi-purposemicroprocessor-based computer systems accessing stored software thatprograms or configures the computing system from a general purposecomputing apparatus to a specialized computing apparatus implementingone or more aspects of the present subject matter. Any suitableprogramming, scripting, or other type of language or combinations oflanguages may be used to implement the teachings contained herein insoftware to be used in programming or configuring a computing device.

Aspects of the methods disclosed herein may be performed in theoperation of such computing devices. The order of the blocks presentedin the examples above can be varied—for example, blocks can bere-ordered, combined, and/or broken into sub-blocks. Certain blocks orprocesses can be performed in parallel.

The use of “adapted to” or “configured to” herein is meant as open andinclusive language that does not foreclose devices adapted to orconfigured to perform additional tasks or steps. Additionally, the useof “based on” is meant to be open and inclusive, in that a process,step, calculation, or other action “based on” one or more recitedconditions or values may, in practice, be based on additional conditionsor values beyond those recited. Headings, lists, and numbering includedherein are for ease of explanation only and are not meant to belimiting.

While the present subject matter has been described in detail withrespect to specific aspects thereof, it will be appreciated that thoseskilled in the art, upon attaining an understanding of the foregoing,may readily produce alterations to, variations of, and equivalents tosuch aspects. Accordingly, it should be understood that the presentdisclosure has been presented for purposes of example rather thanlimitation, and does not preclude the inclusion of such modifications,variations, and/or additions to the present subject matter as would bereadily apparent to one of ordinary skill in the art.

What is claimed is:
 1. A method comprising: computing a palette flowthat maps colors of a target color palette of a target graphic to colorsof a source color palette for a source graphic, wherein the palette flowincludes at least a set of flows between colors of the source colorpalette and a target color of the target color palette and whereincomputing the palette flow comprises minimizing an earth-mover distancebetween a target color distribution of the target color palette and asource color distribution of the source color palette, wherein theearth-mover distance is minimized subject to at least one of: (i) a sumof flows for each target color in the target color palette being lessthan or equal to a weight of the target color in the target colordistribution; or (ii) a sum of flows for each source color in the sourcecolor palette being less than or equal to a weight of the source colorin the source color distribution; mapping, via the palette flow, thetarget color from the target graphic to a modified target color that isa weighted combination of source colors from the source color palette,wherein weights of the weighted combination are a function of the set offlows between the colors of the source color palette and the targetcolor; and performing a modification to the target graphic by recoloringan object in the target color with the modified target color.
 2. Themethod of claim 1, further comprising computing the weighted combinationof source colors by dividing a summation of the target color multipliedby the set of flows by a summation of the set of flows.
 3. The method ofclaim 1, wherein minimizing the earth-mover distance further comprises:computing a total target weight that is a sum of weights of the colorsin the target color palette; computing a total source weight that is asum of weights of the colors in the source color palette; and selectinga total flow constraint that is a minimum of the total target weight andthe total source weight.
 4. The method of claim 1, further comprising:retrieving, via a recoloring tool of a graphics manipulationapplication, a set of source graphics that includes the source graphic;displaying, via the recoloring tool, the target graphic and the set ofsource graphics; receiving a selection of the source graphic within therecoloring tool; receiving, via the recoloring tool, a recoloringcommand; and applying, responsive to the recoloring command, colorinformation from the source color palette to the target graphic.
 5. Themethod of claim 1, further comprising: presenting, in a recoloring toolof a graphics manipulation application, a weight modification interfaceelement for controlling one or more weights of the source color palette;modifying, responsive to user input to the weight modification interfaceelement, the one or more weights of the source color palette, whereinthe palette flow is computed with the one or more weights of the sourcecolor palette as modified; and generating, with the recoloring tool, arecolored target graphic that is generated from the modification to thetarget graphic.
 6. The method of claim 1, wherein colors of the sourcegraphic are represented as color vectors, wherein each color vector hasa luminance vector element identifying a luminance value, the methodfurther comprising: presenting, in a recoloring tool of a graphicsmanipulation application, a luminance control interface element;modifying, responsive to user input to the luminance control interfaceelement, a luminance control setting to exclude the luminance value ofone or more colors of the source graphic from a palette-extractionprocess; and obtaining the source color palette from the source graphicby applying the palette-extraction process to the color vectors, whereinthe applied palette extraction process excludes the luminance vectorelement of one or more of the color vectors.
 7. The method of claim 1,further comprising calculating a weight of the target color in thetarget color distribution from a number of pixels used to display thetarget color by: creating a rasterized graphic from the target graphic;identifying a number of pixels in the rasterized graphic having thetarget color; and determining the respective weight by normalizing thenumber of pixels with respect to a total number of pixels in therasterized graphic.
 8. A system comprising: a non-transitorycomputer-readable medium storing computer-executable programinstructions; and a processing device communicatively coupled to thenon-transitory computer-readable medium for executing thecomputer-executable program instructions, wherein executing thecomputer-executable program instructions configures the processingdevice to perform operations comprising: computing a palette flow thatmaps colors of a target color palette of a target graphic to colors of asource color palette for a source graphic, wherein the palette flowincludes at least a set of flows between colors of the source colorpalette and a target color of the target color palette and whereincomputing the palette flow comprises minimizing an earth-mover distancebetween a target color distribution of the target color palette and asource color distribution of the source color palette, wherein theearth-mover distance is minimized subject to at least one of: (i) a sumof flows for each target color in the target color palette being lessthan or equal to a weight of the target color in the target colordistribution; or (ii) a sum of flows for each source color in the sourcecolor palette being less than or equal to a weight of the source colorin the source color distribution; mapping, via the palette flow, thetarget color from the target graphic to a modified target color that isa weighted combination of source colors from the source color palette,wherein weights of the weighted combination are a function of the set offlows between the colors of the source color palette and the targetcolor; and performing a modification to the target graphic by recoloringan object in the target color with the modified target color.
 9. Thesystem of claim 8, wherein the operations further comprise computing theweighted combination of source colors by dividing a summation of thetarget color multiplied by the set of flows by a summation of the set offlows.
 10. The system of claim 8, wherein minimizing the earth-moverdistance further comprises: computing a total target weight that is asum of weights of the colors in the target color palette; computing atotal source weight that is a sum of weights of the colors in the sourcecolor palette; and selecting a total flow constraint that is a minimumof the total target weight and the total source weight.
 11. The systemof claim 8, wherein the operations further comprise: retrieving, via arecoloring tool of a graphics manipulation application, a set of sourcegraphics that includes the source graphic; displaying, via therecoloring tool, the target graphic and the set of source graphics;receiving a selection of the source graphic within the recoloring tool;receiving, via the recoloring tool, a recoloring command; and applying,responsive to the recoloring command, color information from the sourcecolor palette to the target graphic.
 12. The system of claim 8, whereinthe operations further comprise: presenting, in a recoloring tool of agraphics manipulation application, a weight modification interfaceelement for controlling one or more weights of the source color palette;modifying, responsive to user input to the weight modification interfaceelement, the one or more weights of the source color palette, whereinthe palette flow is computed with the one or more weights of the sourcecolor palette as modified; and generating, with the recoloring tool, arecolored target graphic that is generated from the modification to thetarget graphic.
 13. The system of claim 8, wherein colors of the sourcegraphic are represented as color vectors, wherein each color vector hasa luminance vector element identifying a luminance value, and whereinthe operations further comprise: presenting, in a recoloring tool of agraphics manipulation application, a luminance control interfaceelement; modifying, responsive to user input to the luminance controlinterface element, a luminance control setting to exclude the luminancevalue of one or more colors of the source graphic from apalette-extraction process; and obtaining the source color palette fromthe source graphic by applying the palette-extraction process to thecolor vectors, wherein the applied palette extraction process excludesthe luminance vector element of one or more of the color vectors.
 14. Anon-transitory computer-readable storage medium storingcomputer-executable program instructions, wherein when executed by aprocessing device, the computer-executable program instructions causethe processing device to perform operations comprising: computing apalette flow that maps colors of a target color palette of a targetgraphic to colors of a source color palette for a source graphic,wherein the palette flow includes at least a set of flows between colorsof the source color palette and a target color of the target colorpalette and wherein computing the palette flow comprises minimizing anearth-mover distance between a target color distribution of the targetcolor palette and a source color distribution of the source colorpalette, wherein the earth-mover distance is minimized subject to atleast one of: (i) a sum of flows for each target color in the targetcolor palette being less than or equal to a weight of the target colorin the target color distribution; or (ii) a sum of flows for each sourcecolor in the source color palette being less than or equal to a weightof the source color in the source color distribution; mapping, via thepalette flow, the target color from the target graphic to a modifiedtarget color that is a weighted combination of source colors from thesource color palette, wherein weights of the weighted combination are afunction of the set of flows between the colors of the source colorpalette and the target color; and performing a modification to thetarget graphic by recoloring an object in the target color with themodified target color.
 15. The non-transitory computer-readable storagemedium of claim 14, wherein the operations further comprise computingthe weighted combination of source colors by dividing a summation of thetarget color multiplied by the set of flows by a summation of the set offlows.
 16. The non-transitory computer-readable storage medium of claim14, wherein minimizing the earth-mover distance further comprises:computing a total target weight that is a sum of weights of the colorsin the target color palette; computing a total source weight that is asum of weights of the colors in the source color palette; and selectinga total flow constraint that is a minimum of the total target weight andthe total source weight.
 17. The non-transitory computer-readablestorage medium of claim 14, wherein the operations further comprise:retrieving, via a recoloring tool of a graphics manipulationapplication, a set of source graphics that includes the source graphic;displaying, via the recoloring tool, the target graphic and the set ofsource graphics; receiving a selection of the source graphic within therecoloring tool; receiving, via the recoloring tool, a recoloringcommand; and applying, responsive to the recoloring command, colorinformation from the source color palette to the target graphic.
 18. Thenon-transitory computer-readable storage medium of claim 14, wherein theoperations further comprise: presenting, in a recoloring tool of agraphics manipulation application, a weight modification interfaceelement for controlling one or more weights of the source color palette;modifying, responsive to user input to the weight modification interfaceelement, the one or more weights of the source color palette, whereinthe palette flow is computed with the one or more weights of the sourcecolor palette as modified; and generating, with the recoloring tool, arecolored target graphic that is generated from the modification to thetarget graphic.
 19. The non-transitory computer-readable storage mediumof claim 14, wherein colors of the source graphic are represented ascolor vectors, wherein each color vector has a luminance vector elementidentifying a luminance value, wherein the operations further comprise:presenting, in a recoloring tool of a graphics manipulation application,a luminance control interface element; modifying, responsive to userinput to the luminance control interface element, a luminance controlsetting to exclude the luminance value of one or more colors of thesource graphic from a palette-extraction process; and obtaining thesource color palette from the source graphic by applying thepalette-extraction process to the color vectors, wherein the appliedpalette extraction process excludes the luminance vector element of oneor more of the color vectors.
 20. The non-transitory computer-readablestorage medium of claim 14, wherein the operations further comprisecalculating a weight of the target color in the target colordistribution from a number of pixels used to display the target colorby: creating a rasterized graphic from the target graphic; identifying anumber of pixels in the rasterized graphic having the target color; anddetermining the respective weight by normalizing the number of pixelswith respect to a total number of pixels in the rasterized graphic.